package com.example.maxboxtwo.utils.listeners;

import android.content.Intent;
import android.view.View;

import com.example.maxboxtwo.MainActivity;
import com.example.maxboxtwo.R;
import com.example.maxboxtwo.components.activities.LEDActivity;

import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;

public class ComponentSelectorListener implements View.OnClickListener {
    private Intent intent=null;
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.led:
                intent = new Intent(MainActivity.context,LEDActivity.class);
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
            break;
            case R.id.twoBar:
                intent = new Intent("com.example.components.activities.BarCode.ACTION_START");
                intent.addCategory("android.intent.category.BARCODE");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
            break;
            case R.id.trumpet:
                intent = new Intent("com.example.components.activities.DecibelDevice.ACTION_START");
                intent.addCategory("android.intent.category.DecibelDevice");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
            break;
            case R.id.horizontal:
                intent = new Intent("com.example.components.activities.Gradienter.ACTION_START");
                intent.addCategory("android.intent.category.GRADIENT");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;
            case R.id.compass:
                intent = new Intent("android.intent.action.Compass");
                intent.addCategory("android.intent.category.MY_COMPASS");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;
            case R.id.light:
                intent = new Intent("com.example.components.activities.Light.ACTION_START");
                intent.addCategory("android.intent.category.LIGHT");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;
            case R.id.mirror:
                intent = new Intent("com.example.components.activities.Mirror.ACTION_START");
                intent.addCategory("android.intent.category.Mirror");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;
            case R.id.expand:
                intent = new Intent("com.example.components.activities.ExpandScope.ACTION_START");
                intent.addCategory("android.intent.category.ExpandScope");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;
            case R.id.ruler:
                intent = new Intent("com.example.components.activities.Ruler.ACTION_START");
                intent.addCategory("android.intent.category.Ruler");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);

                break;
            case R.id.protractor:
                intent = new Intent("com.example.components.activities.Angle.ACTION_START");
                intent.addCategory("android.intent.category.Angle");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;
            case R.id.unitChange:
                intent = new Intent("com.example.components.activities.UnitTransition.ACTION_START");
                intent.addCategory("android.intent.category.UnitTransition");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;
            case R.id.sizeTable:
                intent = new Intent("com.example.components.activities.SizeForm.ACTION_START");
                intent.addCategory("android.intent.category.SizeForm");
                intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
                MainActivity.context.startActivity(intent);
                break;

        }
    }
}
